1.4 Addition and Subtraction of Binary Numbers
Binary arithmetic forms the bedrock of all operations within digital
computers. While the concept might seem unfamiliar at first, adding and
subtracting binary numbers follows rules remarkably similar to those of decimal
arithmetic, with the key difference being the limited set of digits (0 and 1).
This section will explore the fundamental principles and techniques for
performing addition and subtraction directly on binary numbers, including
understanding carries and borrows, which are crucial for multi-bit operations.
Mastery of these basic operations is essential for comprehending how computers
perform more complex calculations.
Part 1.4.1 Addition of
Binary Numbers
To add binary numbers, we must understand how to add single
binary bits.
Basic Rules of Addition
0 + 0 = 1
0 + 1 = 1
1 + 0 = 1
1 + 1 = 0 plus a carry-over 1
Carry-over operations in binary addition are analogous to
those in decimal arithmetic. Given that 1 is the maximum digit in the binary
system, any sum exceeding 1 necessitates a carry-over.
Example
No. 1
Add 11110101 to 11101011
Solution:
|
9th Bit |
8th Bit |
7th Bit |
6th Bit |
5th Bit |
4th Bit |
3rd Bit |
2nd Bit |
1st Bit |
Carry Over |
|
1 |
1 |
1 |
1 |
1 |
1 |
1 |
|
Augend |
|
1 |
1 |
1 |
1 |
0 |
1 |
0 |
1 |
Addend |
|
1 |
1 |
1 |
0 |
1 |
0 |
1 |
1 |
Sum |
1 |
1 |
1 |
1 |
0 |
0 |
0 |
0 |
0 |
Let’s read it from left to right, the answer is:
111100002
Example
No. 2
Add 11101010101110 to 1110011001011
Solution:
|
15th Bit |
14th Bit |
13th Bit |
12th Bit |
11th Bit |
10th Bit |
9th Bit |
8th Bit |
7th Bit |
6th Bit |
5th Bit |
4th Bit |
3rd Bit |
2nd Bit |
1st Bit |
Carry Over |
1 |
1 |
1 |
0 |
0 |
0 |
1 |
0 |
0 |
0 |
1 |
1 |
1 |
0 |
|
Augend |
|
1 |
1 |
1 |
0 |
1 |
0 |
1 |
0 |
1 |
0 |
1 |
1 |
1 |
0 |
Addend |
|
|
1 |
1 |
1 |
0 |
0 |
1 |
1 |
0 |
0 |
1 |
0 |
1 |
1 |
Sum |
1 |
0 |
1 |
0 |
1 |
1 |
1 |
0 |
1 |
1 |
1 |
1 |
0 |
0 |
1 |
Let’s read it from left to right, the answer is:
1010111011110012
Part 1.4.2 Subtraction of
Binary Numbers
To subtract binary
numbers, we must understand how to subtract single binary bits.
Basic Rules of Subtraction
0 - 0 = 0
0 - 1 = 1 with a borrow of 1
1 - 0 = 1
1 - 1 = 0
Example
No. 3
Subtract 1000 from 1011
Solution:
|
5th Bit |
4th Bit |
3rd Bit |
2nd Bit |
1st Bit |
Borrow |
|
|
|
|
|
Minuend |
|
1 |
0 |
1 |
1 |
Subtrahend |
|
1 |
0 |
0 |
0 |
Difference |
|
0 |
0 |
1 |
1 |
Let’s read it from left to right, the answer is: 00112
Example
No. 4
Subtract 101110 from 11100101
Solution:
|
8th Bit |
7th Bit |
6th Bit |
5th Bit |
4th Bit |
3rd Bit |
2nd Bit |
1st Bit |
Borrow |
|
0 |
0 |
1 |
1 |
0 |
|
|
Minuend |
1 |
1 |
1 |
0 |
0 |
1 |
0 |
1 |
Subtrahend |
0 |
0 |
1 |
0 |
1 |
1 |
1 |
0 |
Difference |
1 |
0 |
1 |
1 |
0 |
1 |
1 |
1 |
Let’s read it from left to right, the answer is:
101101112